webpackJsonp([27],{

/***/ "VaEk":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/promise.js
var promise = __webpack_require__("rVsN");
var promise_default = /*#__PURE__*/__webpack_require__.n(promise);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__("KH7x");
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/object/assign.js
var object_assign = __webpack_require__("aA9S");
var assign_default = /*#__PURE__*/__webpack_require__.n(object_assign);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/plugin/utils/bridge.js
var bridge = __webpack_require__("4Bcj");

// EXTERNAL MODULE: ./node_modules/_lodash@4.17.11@lodash/lodash.js
var lodash = __webpack_require__("psq8");
var lodash_default = /*#__PURE__*/__webpack_require__.n(lodash);

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/twoDoor/index.vue






//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//




/* harmony default export */ var twoDoor = ({
  data: function data() {
    return {
      active: false,
      items: []
    };
  },
  activated: function activated() {
    if (this.$router.$isBack) return;
    this.initData();
    this.onSubscribe();
  },
  deactivated: function deactivated() {
    this.onUnsubscribe();
  },

  methods: {
    initData: function initData() {
      var _this = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
        var param, entId, equalTo, videoParam, p, _ref, _ref2, items, videos, videosMap;

        return regenerator_default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                param = assign_default()({ equalTo: _this.$route.query }, { include: ['enterpriseId'] });
                entId = _this.$route.query.enterpriseId;
                equalTo = entId ? { equalTo: { EnterpriseName: entId, EquipmentCode: '1' } } : { equalTo: { EquipmentCode: '1' } };
                videoParam = assign_default()(extends_default()({}, equalTo, { exists: ['Coordinate'] }));
                p = [commonApi["a" /* commonApi */].search('measure_cate', param), commonApi["a" /* commonApi */].search('measure_video', videoParam)];
                _context.next = 7;
                return promise_default.a.all(p);

              case 7:
                _ref = _context.sent;
                _ref2 = slicedToArray_default()(_ref, 2);
                items = _ref2[0];
                videos = _ref2[1];


                // 摄像头型号不一致，地址需要转换
                videos.map(function (v) {
                  v.DeviceNum ? v.AddressIP = 'http://218.92.104.98:8388/mag/hls/' + v.DeviceNum + '/0/live.m3u8' : '';
                });

                videosMap = lodash_default.a.groupBy(videos, 'EnterpriseName.id');

                _this.items = items.map(function (v) {
                  return extends_default()({}, v, {
                    active: false,
                    videoActive: false,
                    videos: videosMap[v.enterpriseId.id]
                  });
                });

              case 14:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this);
      }))();
    },
    onSubscribe: function onSubscribe() {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _this2.subscribe = commonApi["a" /* commonApi */].liveQuery('measure_cate');
                _this2.subscribe.on('update', function (object) {
                  var index = _this2.items.findIndex(function (v) {
                    return v.id === object.id;
                  });
                  var curObj = _this2.items[index];
                  if (index !== -1) {
                    _this2.items.splice(index, 1, extends_default()({
                      id: object.id
                    }, curObj, object.attributes));
                  }
                });

              case 2:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this2);
      }))();
    },
    onUnsubscribe: function onUnsubscribe() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _this3.subscribe.unsubscribe();

              case 1:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this3);
      }))();
    },
    onPlay: function onPlay(video) {
      bridge["a" /* bridge */].Play(video.AddressIP);
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-b4e46b32","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/twoDoor/index.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{staticClass:"two-door-page",attrs:{"title":"二道门信息管理","scroll":""}},_vm._l((_vm.items),function(item,index){return _c('yt-card',{key:index},[_c('yt-cell',{attrs:{"label":"企业名称","value":item.enterpriseId.attributes.EnterpriseName}}),_vm._v(" "),_c('yt-cell',{attrs:{"label":"卡口编号","value":item.code}}),_vm._v(" "),_c('yt-cell',{attrs:{"label":"推送时间"}},[_c('span',{staticClass:"c-red"},[_vm._v(_vm._s(item.time))])]),_vm._v(" "),_c('yt-cell',{attrs:{"label":"厂内人员","value":item.totalPerson}}),_vm._v(" "),_c('yt-cell',{attrs:{"label":"厂内车辆","value":item.totalVehicle}}),_vm._v(" "),(item.videos)?_c('yt-collapse',{attrs:{"list":[1]},model:{value:(item.videoActive),callback:function ($$v) {_vm.$set(item, "videoActive", $$v)},expression:"item.videoActive"}},[_c('span',{attrs:{"slot":"title"},slot:"title"},[_vm._v("周边视频")]),_vm._v(" "),_vm._l((item.videos),function(video,key){return _c('p',{key:key,on:{"click":function($event){return _vm.onPlay(video)}}},[_vm._v(_vm._s(video.DeviceName))])})],2):_vm._e(),_vm._v(" "),_c('yt-collapse',{attrs:{"list":[1]},model:{value:(item.active),callback:function ($$v) {_vm.$set(item, "active", $$v)},expression:"item.active"}},[_c('span',{attrs:{"slot":"title"},slot:"title"},[_vm._v("人员明细")]),_vm._v(" "),_c('table',{staticClass:"table"},[_c('thead',[_c('tr',[_c('td',[_vm._v("部门名称")]),_vm._v(" "),_c('td',[_vm._v("人员数量")])])]),_vm._v(" "),_c('tbody',_vm._l((item.detailed),function(subItem,subIndex){return _c('tr',{key:subIndex},[_c('td',[_vm._v(_vm._s(subItem.department))]),_vm._v(" "),_c('td',[_vm._v(_vm._s(subItem.count))])])}),0)])])],1)}),1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var anjian_twoDoor = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/twoDoor/index.vue
function injectStyle (ssrContext) {
  __webpack_require__("fq0/")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-b4e46b32"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  twoDoor,
  anjian_twoDoor,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var common_anjian_twoDoor = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "fq0/":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});